package com.edu.employee.service.impl;

import com.edu.commons.ServiceCode;
import com.edu.commons.ServiceException;
import com.edu.employee.mapper.DeptMapper;
import com.edu.employee.pojo.entity.Dept;
import com.edu.employee.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ProjectName: summer-project
 * @Titile: DeptServiceImpl
 * @Author: Lucky
 * @Description: 部门业务实现类
 */
@Service
public class DeptServiceImpl implements DeptService {
    @Autowired
    private DeptMapper deptMapper;
    @Override
    public List<Dept> getList() {
        List<Dept> deptList =  deptMapper.getList();
        if(deptList==null || deptList.isEmpty()){
            throw new ServiceException(ServiceCode.ERROR_DATA_NOT_FOUND,"没有查询到部门数据");
        }
        return deptList;
    }
}
